﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace smp.ButterflyCakes.Models.FormModels.Order
{
    public class ContactInformationModel : IOrderModel
    {
        #region Implementation of IOrderModel

        [Required]
        public Guid OrderId { get; set; }
        [Required]
        public Guid ComponentId { get; set; }

        #endregion

        public string Title { get; set; }
        [Required]
        public string FirstName { get; set; }
        [Required]
        public string LastName { get; set; }
        public string Email { get; set; }
        public string Facebook { get; set; }
        public string PhoneNumber { get; set; }
        public string HouseNameNumber { get; set; }
        public string Street { get; set; }
        public string Town { get; set; }
        public string County { get; set; }
        public string PostCode { get; set; }
        public Guid? ContactId { get; set; }
        public string SearchName
        {
            get
            {
                var name = "";
                if (!string.IsNullOrEmpty(Title))
                {
                    name += Title;
                }
                if (!string.IsNullOrEmpty(FirstName))
                {
                    if (name.Length > 0)
                        name += " ";
                    name += FirstName;
                }
                if (!string.IsNullOrEmpty(LastName))
                {
                    if (name.Length > 0)
                        name += " ";
                    name += LastName;
                }
                return name;
            }
        }

        public SelectItem TitleSelect
        {
            get
            {
                return new SelectItem("Title", true, new List<SelectOption>
                                                   {
                                                       new SelectOption("Mr", "Mr", Title == "Mr"),
                                                       new SelectOption("Mrs", "Mrs", Title == "Mrs"),
                                                       new SelectOption("Miss", "Miss", Title == "Miss"),
                                                       new SelectOption("Ms", "Ms", Title == "Ms"),
                                                       new SelectOption("Dr", "Dr", Title == "Dr"),
                                                       new SelectOption("Rev", "Rev", Title == "Rev")
                                                   });
            }
        }
    }
}
